{% extends base %}

{% block head %}
<style type="text/css">
    /* 上传文件样式 */
    .progress {
        background-color: #f90;
        color: #fff;
        height: 20px;
        display: none;
        margin-left: 5px;
        border-width: 3px;
    }
    .progress span {
        display: block;
        background-color: #f90;
        color: #fff;
        height: 100%;
    }
    
    .finished-tag {
        color: #fff;
        background-color: green;
        border-width: 3px;
        border-radius: 3px;
        margin-left: 5px;
    }

    .option-td {
        width: 25%;
    }
</style>

{% set search_action = '/fs_upload/search' %}
{% set search_placeholder = '搜索文件' %}

{% end %}

{% block body %}
    
    {% init page = "upload" %}

    <input type="hidden" id="dirname" value="{{dirname}}"/>

    {% if page == "upload" %}
    <div class="card">
        日期
        <select name="year" value="{{year}}">
            {% for j in range(year-5,year+6) %}
                <option value="{{j}}">{{j}}</option>
            {% end %}
        </select>
        <select name="month" value="{{month}}">
            {% for i in range(1,13) %}
                <option value="{{i}}">{{i}}</option>
            {% end %}
        </select>

        <div class="float-right">
            <a href="{{upload_link_by_month(year, month, -1)}}" class="default-path-link">上个月</a>
            <a href="{{upload_link_by_month(year, month, 1)}}" class="default-path-link">下个月</a>
            <a href="/note/index" class="desktop-only-inline default-path-link">索引</a>
            {% if _is_admin %}
                <a href="/fs_list">管理</a>
            {% end %}
        </div>
    </div>
    {% end %}

    {% if page == "search" %}
    <div class="card">
        <h3>搜索结果</h3>
    </div>
    {% end %}

    {% import os %}
    <div class="card row">
        {% if page == "upload" %}
            {% include fs/mod_fs_upload.html %}
        {% end %}

        {% if len(pathlist) == 0 %}
            空空如也~
        {% end %}

        {% include fs/component/filelist_simple.html %}
    </div>

    <script>
    $(function () {
        $("select").change(function (e) {
            var year = $("[name=year]").val();
            var month = $("[name=month]").val();
            location.href = "?year=" + year + "&month=" + month;
        });
    })
    </script>

{% end %}

{% block aside %}
    <div class="aside-item">
        <div class="aside-title">
            日期
        </div>
        <div class="aside-content">
        </div>
    </div>
{% end %}
